<!DOCTYPE html>
<title>Test VideoFrame drawImage() performance</title>
<script src="../resources/runner.js"></script>
<script src="videoFrame-utils.js"></script>

<canvas id="canvas" width="1280" height="720"></canvas>

<script>
(async function() {
  let frame = await createDecodedFrame();
  if (frame == null) {
    PerfTestRunner.logFatalError("No frame decoded");
    return;
  }

  const canvas = document.getElementById("canvas");
  const ctx = canvas.getContext("2d");

  PerfTestRunner.measureInnerRAFTime({
    description: "CPU time for drawImage()",
    run() {
      for (let i = 0; i < 10; i++) {
        ctx.drawImage(frame, 0, 0);
      }
    }
  });
})();
</script>
